package main

import (
	"fmt"
	"regexp"
)

var text = `my emails is abc@126.com
email0 xyz@126.com
email1 hhh@gmail.com
email2 zhangsan@baidu.com.cn
email3 253698773@qq.com
`
func main(){
	re := regexp.MustCompile("abc@126.com")
	results := re.FindAllString(text, -1)
	fmt.Println(results)

	re = regexp.MustCompile(`[a-zA-Z0-9]+@[a-zA-Z0-9.]+.[a-zA-Z0-9]+`)
	results = re.FindAllString(text, -1)
	fmt.Println(results)
	fmt.Println("******************************")
	re = regexp.MustCompile(`([a-zA-Z0-9]+)@([a-zA-Z0-9.]+.[a-zA-Z0-9]+)`)
	allStringSubMatch := re.FindAllStringSubmatch(text, -1)
	for _,result:= range allStringSubMatch {
		fmt.Println(result)
	}
	fmt.Println("************************")
	var text2 = `<a href="http://www.zhenai.com/zhenghun/jinchang" data-v-1573aa7c>金昌</a>
<a href="http://www.zhenai.com/zhenghun/jincheng" data-v-1573aa7c>晋城</a>`
	regex := regexp.MustCompile(`<a href="http://www.zhenai.com/zhenghun/[a-zA-Z0-9]+" data-v-1573aa7c>[^<]+</a>`)
	matchResult := regex.FindAllString(text2, -1)
	for _,result:= range matchResult{
		fmt.Printf("%s\n",result)
	}
}
